﻿using M.Warehouse.API.Application.Command.BinLocationsCommand;
using M.Warehouse.Repository.WarehouseInterface;
using MediatR;

namespace M.Warehouse.API.Application.CommandHandlers.BinLocationsCommandHandlers
{
    /// <summary>
    /// 新增库位
    /// </summary>
    public class BinLocationsCreateCommandHandler : IRequestHandler<BinLocationsCreateCommand, int>
    {

        private readonly IBinLocationsRepository _repository;
        public BinLocationsCreateCommandHandler(IBinLocationsRepository repository)
        {
            _repository = repository;
        }

        public async Task<int> Handle(BinLocationsCreateCommand request, CancellationToken cancellationToken)
        {
            return await _repository.AddAsync(request);
        }
    }
}
